package com.dushibao.service.impl;

import com.dushibao.common.Constants;
import com.dushibao.dao.ArticleDao;
import com.dushibao.entity.Article;
import com.dushibao.service.ArticleService;
import com.dushibao.utils.Page;

import java.util.List;

public class ArticleServiceImpl implements ArticleService {
    ArticleDao articleDao = new ArticleDao();

    @Override
    public Integer save(Article article) {
        return articleDao.save(article);
    }

    @Override
    public Page page(Page page, String author, String title) {
        return articleDao.page(page,author,title);
    }

    @Override
    public Article getById(long id) {
        return articleDao.getById(id);
    }

    @Override
    public Integer saveOrUpdate(Article article) {
        if(article.getId()!=null){
            return articleDao.update(article);
        }
        return articleDao.save(article);
    }

    @Override
    public Integer deleteById(List<Long> ids) {
        return articleDao.deleteById(ids);
    }
}
